using UnityEngine;
using System.Collections;

public class LanguageMenu : Menu 
{
	void Start()
	{		
		base._manager = gameObject.GetComponent<MenuManager>();
		base.amount = _manager.amount;
	
		beginNavigationY(limit,yieldReturnControls);
		
		effectSwitch(0);

	}
	
	void Update()
	{			
		if(base.ready && Input.GetAxisRaw("Vertical") != 0)
		{
			base.navigationY();
			this.effectSwitch(actualNavigationPosY);
		}
		
		if(base.ready && base.hasPressEnter())
		{
			this.executeAction(actualNavigationPosY);
		}
				
	}
	
	public override void effectSwitch(int number)
	{
		if(number != lastNumberY)
		{
			this.effectSwitchFlashColors(this.actualNavigationPosY,this.lastNumberY);
		}
		else if(!ready)
		{
			this.effectSwitchFlashColors(this.actualNavigationPosY,this.lastNumberY);
		}
	}
	
	public override void executeAction(int number)
	{		
		if(number == 0)
		{
			PlayerPrefs.SetString("Language","Portugues");

		}
		
		if(number == 1)
		{
			PlayerPrefs.SetString("Language","English");
		}
		
		if(number != 2)	
		{
			PlayerPrefs.SetInt("HasChangeLanguage",1);
		}

		base._manager.changeSceneAtName("MainMenu");		
	}
	
	void Ready()
	{
		base.ready = true;
	}

}

